<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="По результатам работы за период " pageWidth="595" pageHeight="842" whenNoDataType="BlankPage" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="ru/apertum/qsystem/reports/templates/i3-label-rep" uuid="7b3e8b70-5edd-4254-a4a7-2d5e56fe18dc">
	<property name="ireport.zoom" value="2.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
	<parameter name="sd" class="java.util.Date"/>
	<parameter name="ed" class="java.util.Date"/>
	<parameter name="ed1" class="java.util.Date"/>
	<queryString>
		<![CDATA[SELECT se.id serid, se.name service, st.state_in state, us.name user, count(state_in) cnt
FROM
statistic st

join services se on  st.service_id = se.id and st.client_stand_time >=$P{sd}  AND  st.client_stand_time <=$P{ed1}

join users us on st.user_id = us.id

group by service, state, user


order by service, user, state]]>
	</queryString>
	<field name="service" class="java.lang.String"/>
	<field name="state" class="java.lang.Integer"/>
	<field name="user" class="java.lang.String"/>
	<field name="cnt" class="java.lang.Integer"/>
	<field name="serid" class="java.lang.Long"/>
	<group name="StateGroup">
		<groupExpression><![CDATA[$F{service}]]></groupExpression>
		<groupHeader>
			<band height="38">
				<textField>
					<reportElement uuid="b786d873-0d69-4ea6-85b3-f366cd2513d4" x="1" y="0" width="53" height="20"/>
					<textElement markup="none">
						<font size="12" isBold="true"/>
					</textElement>
					<textFieldExpression><![CDATA[$R{service}+":"]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="false">
					<reportElement uuid="a6d7ae0a-e47b-46d2-8451-55717a05c58a" x="54" y="0" width="501" height="20"/>
					<textElement>
						<font size="12" isUnderline="true"/>
					</textElement>
					<textFieldExpression><![CDATA[$F{service}]]></textFieldExpression>
				</textField>
				<elementGroup>
					<subreport>
						<reportElement uuid="56da3a96-1a26-4a25-a5bb-ae1139813207" x="54" y="20" width="501" height="17"/>
						<subreportParameter name="sd">
							<subreportParameterExpression><![CDATA[$P{sd}]]></subreportParameterExpression>
						</subreportParameter>
						<subreportParameter name="ed">
							<subreportParameterExpression><![CDATA[$P{ed}]]></subreportParameterExpression>
						</subreportParameter>
						<subreportParameter name="ed1">
							<subreportParameterExpression><![CDATA[$P{ed1}]]></subreportParameterExpression>
						</subreportParameter>
						<subreportParameter name="ext_serid">
							<subreportParameterExpression><![CDATA[$F{serid}]]></subreportParameterExpression>
						</subreportParameter>
						<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
						<subreportExpression><![CDATA["jar:file:./dist/QSystem.jar!/ru/apertum/qsystem/reports/templates/resultStateServicesPeriod_subreport1.jasper"]]></subreportExpression>
					</subreport>
				</elementGroup>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="8">
				<line>
					<reportElement uuid="f25e6c10-4be7-433b-85af-2a68ea47e76a" x="0" y="1" width="555" height="1"/>
					<graphicElement>
						<pen lineWidth="1.0" lineStyle="Dashed"/>
					</graphicElement>
				</line>
			</band>
		</groupFooter>
	</group>
	<group name="By user">
		<groupExpression><![CDATA[$F{user}]]></groupExpression>
		<groupHeader>
			<band height="20">
				<textField>
					<reportElement uuid="f8597fc1-4645-4b0e-8985-05c326cbfde1" x="31" y="0" width="73" height="20"/>
					<textElement markup="none">
						<font size="12" isBold="true"/>
					</textElement>
					<textFieldExpression><![CDATA[$R{user}+":"]]></textFieldExpression>
				</textField>
				<textField>
					<reportElement uuid="52dbe100-6969-42d4-b080-e220b1af8386" x="104" y="0" width="451" height="20"/>
					<textElement>
						<font size="12" isUnderline="true"/>
					</textElement>
					<textFieldExpression><![CDATA[$F{user}]]></textFieldExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="2"/>
		</groupFooter>
	</group>
	<title>
		<band height="58">
			<line>
				<reportElement uuid="c8ab8e07-9e28-4b4a-83f4-4681b1217f82" x="0" y="4" width="555" height="1"/>
			</line>
			<line>
				<reportElement uuid="330607c8-b5ad-4c93-beef-7a8ff0220c50" x="0" y="53" width="555" height="1"/>
			</line>
			<textField>
				<reportElement uuid="4057a43a-1054-4396-9202-a6cd999eaf40" x="0" y="7" width="555" height="21"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
					<font size="18" isBold="true" isStrikeThrough="false" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{result_state_services}]]></textFieldExpression>
			</textField>
			<textField pattern="">
				<reportElement uuid="cf480476-f083-4f61-8d7d-6514f560d6ab" x="0" y="28" width="555" height="24"/>
				<textElement textAlignment="Center">
					<font fontName="SansSerif" size="18" isBold="true" isUnderline="false" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{from_date} + " " + (new java.text.SimpleDateFormat("dd.MM.yyyy")).format($P{sd}) + " "+ $R{to_date} +" " + (new java.text.SimpleDateFormat("dd.MM.yyyy")).format($P{ed})]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="21">
			<textField>
				<reportElement uuid="857e58db-03a0-4274-80ae-672afbb4dc4a" x="0" y="0" width="302" height="15"/>
				<textElement markup="none">
					<font size="10"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{produced}+ " " + new Date()]]></textFieldExpression>
			</textField>
			<line>
				<reportElement uuid="03bb79ba-9cca-464b-93a7-958d7bb01e5c" x="0" y="17" width="555" height="1"/>
				<graphicElement>
					<pen lineStyle="Solid" lineColor="#CCCCCC"/>
				</graphicElement>
			</line>
		</band>
	</pageHeader>
	<columnHeader>
		<band/>
	</columnHeader>
	<detail>
		<band height="18" splitType="Prevent">
			<textField>
				<reportElement uuid="085d11e1-9049-483e-aebb-30e3e3142bcd" x="58" y="0" width="497" height="18"/>
				<textElement>
					<font size="12"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{state}.toString().replaceAll( "10", $R{services_for} ).replaceAll( "11", $R{postponed_for} ).replaceAll( "6", $R{redirected_for} ).replaceAll( "0", $R{removed_for} ) +"  "+$F{cnt} +"  "+$R{clients_for}+"."]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band height="24">
			<textField pattern="" isBlankWhenNull="false">
				<reportElement uuid="eb24a44f-cddf-44b2-ae24-870fa7cd1321" key="textField" x="0" y="5" width="145" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement verticalAlignment="Bottom">
					<font size="10" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[new Date()]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="false">
				<reportElement uuid="465e073b-7085-4cb0-93ae-56ecc9dc2d71" key="textField" x="205" y="5" width="350" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right" verticalAlignment="Bottom">
					<font size="10" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{page}+" " + $V{PAGE_NUMBER} + " "+$R{from}+" "+ $V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
	<summary>
		<band/>
	</summary>
</jasperReport>
